#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    // 界面显示的文本
    QString text;

    // 获取信息的工具实例
    Info info;
    // 机器名称
    QString machineName=info.localmachineName();
    text.append("计算机名称：\t\t").append(machineName).append("\n");
    // cpu 信息
    QString cpuInfo=info.cpuInfo();
    text.append("cpu信息：\t\t").append(cpuInfo).append("\n");



    // 网卡信息
    QStringList netList;
    NetWorker netWorker;
    netWorker.getNetList(netList);
    for (int i=0;i<netList.length();i++) {
        text.append("网卡").append(QString::number(i+1)).append(":\t\t").append(netList.at(i)).append("\n");
    }
    text.append(netWorker.getIp());

    netWorker.setIP("ens33","192.168.228.111","255.255.255.0","192.168.228.1");
    ui->textBrowser->setText(text);


}

MainWindow::~MainWindow()
{
    delete ui;
}

